{% extends "base.html" %}

{% block title %} PyF - Login {% endblock %}

{% block content %}
    <script type="text/javascript">
        function submit() {
            $('form[name="loginform"]').submit();
        }
        
        $("input[type='text']").keyup(function(event) {
            if (event.keyCode == 13) {
                $("input[type='password']").focus();
            }
        });

        $("input[type='password']").keyup(function(event) {
            if (event.keyCode == 13) {
                $("form").submit();
            }
        });

        {% if error_msg %}
            displayError("{{ error_msg }}");
        {% endif %}
    </script>

    <div id="logon">
        <form action="/login/" name="loginform" method="POST">
            <div class="label">Login</div>
            <div class="value">
                <input type="text" name="username" size="20"/>
            </div>
            <div class="label">Password</div>
            <div class="value">
                <input type="password" name="password" size="20"/>
            </div>
            <input type="hidden" name="originalURL" value="{{ original_url }}"/>
        </form>
        <div id="actions">
            <button class="action logon" id="submit" href="#">Logon</button>
        </div>
    </div>
{% endblock %}
